function operateFormatterForOrder(value, row, index) {
    return [
        '<a class="detail" href="javascript:void(0)" title="注册码">',
        '<i class="glyphicon glyphicon-barcode"></i>',
        '&nbsp;查看注册码</a>',].join('');
}
window.operateEventsForOrder = {
    'click .detail': function (e, value, row, index) {
        sessionStorage.setItem("bussid", row.bussid);
        sessionStorage.setItem("orgname", row.orgname);
        location.href="#/codeInfo";
    }
};
function operateFormatterForState(value, row, index){
    var state=row.state;
    if(state == 0){
        state='<a style="color:red"><i class="glyphicon glyphicon-eye-close"></i>&nbsp;未激活</a>';
    }else if(state == 1){
        state='<a style="color:green"><i class="glyphicon glyphicon-eye-open"></i>&nbsp;已激活</a>';
    }
    return [
        ''+state+''
    ].join('');
}

function operateFormatterForStates(value, row, index){
    var state=row.state;
    if(state == 200){
        state='<a style="color:green">&nbsp;成功</a>';
    }else if(state == 300){
        state='<a style="color:black">&nbsp;未检测</a>';
    }else{
        state='<a style="color:red">&nbsp;失败</a>';
    }
    return [
        ''+state+''
    ].join('');
}

function operateHandleForStates(value, row, index){
    var states=row.state;
    if(states == 0){
        states='<a style="color:red">&nbsp;未进行</a>';
    }else if(states == 1){
        states='<a style="color:blue">&nbsp;进行中</a>';
    }else if(states == 3){
        states='<a style="color:green">&nbsp;已完成</a>';
    }
    return [
        ''+states+''
    ].join('');
}

function operateFormatterForEditUser(value, row, index) {
    if(row.rolename == sessionStorage.getItem('loginRoleName')){
        return [
            '--',].join('');
    }else{
        return [
            '<a class="edit btn btn-primary" href="javascript:void(0)" title="修改">修改</a>',].join('');
    }
}
window.operateEventsForUser = {
    'click .edit': function (e, value, row, index) {
        sessionStorage.setItem("userid4EditUser", row.userid);
        sessionStorage.setItem("username4EditUser", row.username);
        sessionStorage.setItem("loginname4EditUser", row.loginname);
        sessionStorage.setItem("email4EditUser", row.email);
        sessionStorage.setItem("mobilephone4EditUser", row.mobilephone);
        sessionStorage.setItem("roleid4EditUser", row.roleid);
        sessionStorage.setItem("rolename4EditUser", row.rolename);
        sessionStorage.setItem("companyid4EditUser", row.companyid);
        sessionStorage.setItem("companyname4EditUser", row.companyname);
        location.href="#/editUser";
    },
};
function operateFormatterForEditUser2(value, row, index) {
    if(row.rolename == sessionStorage.getItem('loginRoleName')){
        var str;
        if(row.userstate=="0"){
            str = "OFF";
        }else{
            str = "ON";
        }
        return [str,].join('');
    }else if(row.userstate=="0"){
        return [
            '<div class="toggle-div"><div class="toggle toggle-primary toggle-off" id="'+row.userid+'"></div></div>',].join('');
    }else{
        return [
            '<div class="toggle-div"><div class="toggle toggle-primary toggle-on" id="'+row.userid+'"></div></div>',].join('');
    }
}
function operateFormatterForEditUser3(value, row, index) {
    if(row.rolename == sessionStorage.getItem('loginRoleName')){
        return ['--',].join('');
    }else{
        return [
            '<a class="reset btn btn-danger" data-toggle="modal" data-target="#myModal" href="javascript:void(0)" title="密码重置">密码重置</a>',].join('');
    }
}
window.operateEventsForUser3 = {
    'click .reset': function (e, value, row, index) {
        sessionStorage.setItem("userid4ResetUserPWD", row.userid);
        sessionStorage.setItem("loginname4ResetUserPWD", row.loginname);
        $("#myModalLabel").text('重置  "'+row.username+'" 用户密码');
    },
};
function operateFormatterForEditTarget(value, row, index) {
    var html = "";
    if(checkElement('editTarget,')){
        html = '<a class="edit btn btn-primary" href="javascript:void(0)" title="修改">修改</a>';
    }
    if(checkElement('configureTarget,')){
        html += '&nbsp;&nbsp;<a class="configure btn btn-primary"  href="javascript:void(0)" title="配置">配置</a>';
    }
    if(checkElement('uninstallTarget,') && row.arrangestate != '未部署' && row.arrangestate != '正在部署' && row.state == "0"){
        if(html == ""){
            html = '<a class="uninstall btn btn-danger" href="javascript:void(0)" title="卸载">卸载</a>';
        }else{
            html = html + '&nbsp;&nbsp;<a class="uninstall btn btn-danger" href="javascript:void(0)" title="卸载">卸载</a>';
        }
    }
    if(checkElement('arrangeTarget,') && row.arrangestate != '正在部署' && row.state == "0"){
        if(html == ""){
            html = '<a class="arrange btn btn-info" href="javascript:void(0)" title="一键部署">一键部署</a>';
        }else{
            html = html + '&nbsp;&nbsp;<a class="arrange btn btn-info" href="javascript:void(0)" title="一键部署">一键部署</a>';
        }
    }
    return [html].join('');
}
window.operateEventsForTarget = {
    'click .edit': function (e, value, row, index) {
        sessionStorage.setItem("id4EditTarget", row.id);
        sessionStorage.setItem("location4EditTarget", row.location);
        sessionStorage.setItem("operator4EditTarget", row.operator);
        sessionStorage.setItem("ip4EditTarget", row.ip);
        sessionStorage.setItem("password4EditTarget", row.password);
        sessionStorage.setItem("user4EditTarget", row.user);
        sessionStorage.setItem("targetport4EditTarget", row.targetport);
        sessionStorage.setItem("arrangestate4EditTarget", row.arrangestate);
        location.href="#/editTarget";
    },
    'click .configure': function (e, value, row, index) {
        console.info(row)
        sessionStorage.setItem("id4ConfigureTarget", row.id);
        sessionStorage.setItem("ip4ConfigureTarget", row.ip);
        sessionStorage.setItem("targetport4ConfigureTarget", row.targetport);
        console.info(row.httpport)
        console.info(row.ftpport)
        sessionStorage.setItem("httpport4ConfigureTarget", row.httpport);
        sessionStorage.setItem("ftpport4ConfigureTarget", row.ftpport);
        sessionStorage.setItem("popport4ConfigureTarget", row.popport);
        sessionStorage.setItem("smtpport4ConfigureTarget", row.smtpport);
        sessionStorage.setItem("mailuser4ConfigureTarget", row.mailuser);
        sessionStorage.setItem("domainname4ConfigureTarget", row.domainname);
        location.href="#/configureTarget";
    },
    'click .arrange': function (e, value, row, index) {
        $.ajax({
            type : "POST",
            url : BasePath + '/target/arrange.do',
            data : {
                'id' : row.id
            },
            dataType : "json",
            success : function(data) {
                if (data.retCode == SUCCESS) {
                    successAlert();
                    $('#datatable').bootstrapTable('refresh',{url : BasePath+ '/target/queryTarget.do'});
                } else{
                    messageDanger("一键部署失败",data.retMessage);
                }
            }
        });
    },
    'click .uninstall': function (e, value, row, index) {
        $('.uninstall').attr("disabled", true);
        $.ajax({
            type : "POST",
            url : BasePath + '/target/uninstall.do',
            data : {
                'id' : row.id
            },
            dataType : "json",
            success : function(data) {
                if (data.retCode == SUCCESS) {
                    successAlert();
                    $('#datatable').bootstrapTable('refresh',{url : BasePath+ '/target/queryTarget.do'});
                } else if(data.retCode == "-1"){
                    $('.uninstall').removeAttr("disabled");
                    messageDanger("卸载失败",data.result);
                } else{
                    $('.uninstall').removeAttr("disabled");
                    messageDanger("卸载失败",data.retMessage);
                }
            }
        });
    }
};

function operateFormatterForEditTargets(value, row, index) {
    var html = "";
    if(checkElement('editHandle,')){
        html = '<a class="edit btn btn-primary" href="javascript:void(0)" title="详情">详情</a>';
    }
    if(checkElement('configureHandle,')){
        if(html == ""){
            html = '<a class="configure btn btn-primary"  href="javascript:void(0)" title="统计">统计</a>';
        }else{
            html += '&nbsp;&nbsp;<a class="configure btn btn-primary"  href="javascript:void(0)" title="统计">统计</a>';
        }
    }
    if(checkElement('startHandleInfo,')){
        if(html == ""){
            html = '<a class="start btn btn-primary"  href="javascript:void(0)" title="开始">开始</a>';

        }else{
            html += '&nbsp;&nbsp;<a class="start btn btn-primary"  href="javascript:void(0)" title="开始">开始</a>';
        }
    }
    return [html].join('');
}
window.operateEventsForOrders = {
    'click .edit': function (e, value, row, index) {
        sessionStorage.setItem("id", row.id);
        location.href="#/seeHandle";
    },
    'click .configure': function (e, value, row, index) {
        sessionStorage.setItem("id", row.id);
        $.ajax({
            type : "POST",
            url : BasePath+ "/handle/countHandle.do",
            data : {
                'handleid' : row.id
            },
            dataType : "json",
            success : function(data) {
                sessionStorage.setItem("handlex", JSON.stringify(data.result.dataList));
                sessionStorage.setItem("handley", JSON.stringify(data.result.list));
                location.href="#/countHandle";
            }
        });
    },
    'click .start': function (e, value, row, index) {
        $.ajax({
            type : "POST",
            url : BasePath+ "/handle/runHandle.do",
            data : {
                'id' : row.id
            },
            dataType : "json",
            success : function(data) {
                if (data.retCode == SUCCESS) {
                    $('#datatable').bootstrapTable('refresh',{url : BasePath+ '/handle/queryHandle.do'});
                } else {
                    messageDanger("执行任务失败", data.retMessage);
                }
            }
        });
    }
};






function operateFormatterForEditTarget2(value, row, index) {
    console.info(row);
    console.info(row.arrangestate)
    if(row.arrangestate=="未部署"){
        return [
            '<a class="typeService btn btn-blue" data-toggle="modal" data-target="#myModal" id="'+row.id+'">未开启</a>',].join('');
    }else{
        if(row.state=="0"){
            if(row.ftp=="0"&&row.http=="0"&&row.mail=="0"){
                return [
                    '<a class="typeService btn btn-blue" data-toggle="modal" data-target="#myModal" id="'+row.id+'">成功</a>',].join('');

            }else{
                return [
                    '<a class="typeService btn btn-red" data-toggle="modal" data-target="#myModal" id="'+row.id+'">失败</a>',].join('');
            }
        }else{
            return [
                'OFF',].join('');
        }
    }

}



window.operateFormatterForEditTarget2Event = {
    'click .typeService': function (e, value, row, index) {
        window.clearTimeout(time);
        var ips="";
        for ( var i = 0; i < $('.wi-sunset').length; i++) {
            ips = ips + $('.wi-sunset').eq(i).attr('id') + ",";
        }
        if(ips != ""){
            ips = ips.substring(0, ips.length-1).replace(/-/g,'.');
            time=window.setInterval(myInterval,3000);//1000为1秒钟
            function myInterval(){
                $.ajax({
                    type : "POST",
                    url : BasePath + "/target/getHeartbeat.do",
                    data : {
                        'ips' : ips
                    },
                    dataType : "json",
                    success : function(data) {
                        if (data.retCode == SUCCESS) {
                            var list = data.result;
                            for ( var i = 0; i < list.length; i++){
                               $("#httpid").html("state--"+list[i].httpstate);
                                $("#ftpid").html("ftpstate--"+list[i].ftpstate);
                                $("#jamesid").html("jamesstate--"+list[i].jamesstate);
                            }
                        }
                    }
                });
            }
        }



    }
};

function operateFormatterForEditTarget3(value, row, index) {
    if(row.state=="0"){
        return [
            '<div class="toggle-div"><div class="toggle toggle-primary toggle-on state" id="'+row.id+'"></div></div>',].join('');
    }else{
        return [
            '<div class="toggle-div"><div class="toggle toggle-primary toggle-off state" id="'+row.id+'"></div></div>',].join('');
    }
}
function operateFormatterForEditTarget4(value, row, index) {
    return [
        '<span class="wi-sunset" style="'+row.nowState+'" id="'+row.ip.replace(/\./g,'-')+'-'+row.targetport+'"></span>',].join('');
}

function operateFormatterForSampleBank(value, row, index) {
    return [
        '<a class="detail btn btn-primary" href="javascript:void(0)" title="管理样本">',
        '&nbsp;管理样本</a>',].join('');
}
window.operateEventsForSampleBank = {
    'click .detail': function (e, value, row, index) {
        sessionStorage.setItem("bankid4AddSample", row.id);
        sessionStorage.setItem("type4AddSample", row.type);
        sessionStorage.setItem("bankname4Sample", row.bankname);
        //判断任务类型taskType
        $.ajax({
            type : "POST",
            url : BasePath + "/sampleRelation/checkTaskType.do",
            data : {
                'bankid' : row.id
            },
            dataType : "json",
            success : function(data) {
                if (data.retCode == SUCCESS) {
                    sessionStorage.setItem("flag", 1);
                } else {
                    sessionStorage.setItem("flag", 0);
                }
                location.href = BasePath+ "/#/relationInfo";
            }
        });
    }
};
function operateFormatterForRelation(value, row, index) {
    return [
        '<a class="delete btn btn-danger" data-toggle="modal" data-target="#myModal" href="javascript:void(0)" title="删除">删除</a>',].join('');
}
window.operateEventsForRelation = {
    'click .delete': function (e, value, row, index) {
        sessionStorage.setItem("sampleid4DeleteSample", row.sampleid);
        $("#myModalLabel").text('删除  "'+row.smplename+'" 样本');
    }
};
function operateFormatterForUpdateHttp(value, row, index) {
    if(row.tasktype=="已下发" || row.tasktype=="就绪" || row.tasktype=="进行中"){
        if(row.httpstate=="ON"){
            return [
                '<div class="toggle-div"><div class="toggle toggle-primary toggle-on" id="'+row.id+'"></div></div>',].join('');
        }else{
            return [
                '<div class="toggle-div"><div class="toggle toggle-primary toggle-off" id="'+row.id+'"></div></div>',].join('');
        }
    }else{
        return [row.httpstate,].join('');
    }
}
//任务进度条
function operateFormatterForTasktype(value, row, index){
    var typecss = "<a style='padding-top:3px;padding-bottom:3px; cursor:default'><font size='1px;'>";
    var tasktype1 = '<li id="type1" style="width:100px;">'+typecss+'初始</font></a></li>';
    var tasktype2 = '<li id="type2" style="width:100px;">'+typecss+'正在下发</font></a></li>';
    var tasktype3 = '<li id="type3" style="width:70px;">'+typecss+'已下发</font></a></li>';
    var tasktype4 = '<li id="type4" style="width:60px;">'+typecss+'就绪</font></a></li>';
    var tasktype5 = '<li id="type5" style="width:70px;">'+typecss+'进行中</font></a></li>';
    var tasktype6 = '<li id="type6" style="width:40px;">'+typecss+'完成</font></a></li></ul>';
    if(row.tasktype == "初始"){
        tasktype1 = '<li id="type1" class="active" style="width:100px;">'+typecss+'初始</font></a></li>';
    }else if(row.tasktype == "下发失败"){
        tasktype1 = '<li id="type1" class="active" style="width:100px;">'+typecss+'下发失败</font></a></li>';
    }else if(row.tasktype == "正在下发"){
        tasktype1 = '<li id="type1" class="active" style="width:100px;">'+typecss+'初始</font></a></li>';
        tasktype2 = '<li id="type2" class="active" style="width:100px;">'+typecss+'正在下发</font></a></li>';
    }else if(row.tasktype == "已下发"){
        tasktype1 = '<li id="type1" class="active" style="width:100px;">'+typecss+'初始</font></a></li>';
        tasktype2 = '<li id="type2" class="active" style="width:100px;">'+typecss+'正在下发</font></a></li>';
        tasktype3 = '<li id="type3" class="active" style="width:70px;">'+typecss+'已下发</font></a></li>';
    }else if(row.tasktype == "就绪"){
        tasktype1 = '<li id="type1" class="active" style="width:100px;">'+typecss+'初始</font></a></li>';
        tasktype2 = '<li id="type2" class="active" style="width:100px;">'+typecss+'正在下发</font></a></li>';
        tasktype3 = '<li id="type3" class="active" style="width:70px;">'+typecss+'已下发</font></a></li>';
        tasktype4 = '<li id="type4" class="active" style="width:60px;">'+typecss+'就绪</font></a></li>';
    }else if(row.tasktype == "进行中"){
        tasktype1 = '<li id="type1" class="active" style="width:100px;">'+typecss+'初始</font></a></li>';
        tasktype2 = '<li id="type2" class="active" style="width:100px;">'+typecss+'正在下发</font></a></li>';
        tasktype3 = '<li id="type3" class="active" style="width:70px;">'+typecss+'已下发</font></a></li>';
        tasktype4 = '<li id="type4" class="active" style="width:60px;">'+typecss+'就绪</font></a></li>';
        tasktype5 = '<li id="type5" class="active" style="width:70px;">'+typecss+'进行中</font></a></li>';
    }else if(row.tasktype == "完成"){
        tasktype1 = '<li id="type1" class="active" style="width:100px;">'+typecss+'初始</font></a></li>';
        tasktype2 = '<li id="type2" class="active" style="width:100px;">'+typecss+'正在下发</font></a></li>';
        tasktype3 = '<li id="type3" class="active" style="width:70px;">'+typecss+'已下发</font></a></li>';
        tasktype4 = '<li id="type4" class="active" style="width:60px;">'+typecss+'就绪</font></a></li>';
        tasktype5 = '<li id="type5" class="active" style="width:70px;">'+typecss+'进行中</font></a></li>';
        tasktype6 = '<li id="type6" class="active" style="width:40px;">'+typecss+'完成</font></a></li>';
    }else{
        tasktype1 = '<li id="type1" class="active" style="width:100px;">'+typecss+'初始</font></a></li>';
        tasktype2 = '<li id="type2" class="active" style="width:100px;">'+typecss+'正在下发</font></a></li>';
        tasktype3 = '<li id="type3" class="active" style="width:70px;">'+typecss+'已下发</font></a></li>';
        tasktype4 = '<li id="type4" class="active" style="width:60px;">'+typecss+'就绪</font></a></li>';
        tasktype5 = '<li id="type5" class="active" style="width:70px;">'+typecss+'进行中</font></a></li>';
        tasktype6 = '<li id="type6" class="active" style="width:40px;">'+typecss+'撤销</font></a></li>';
    }
    var html = '<ul class="nav nav-pills nav-justified step step-arrow" style="width: 440px;">'+tasktype1+tasktype2+
        tasktype3+tasktype4+tasktype5+tasktype6+'</ul>';
    return [html].join('');
}
//
function operateFormatterForTask(value, row, index) {
    var htmlStr = "--";
    var type=row.tasktype;
    if(checkElement('taskMore,')){
        htmlStr = '<a class="taskMore btn btn-white" data-toggle="modal" data-target="#myLargeModalLabel" href="javascript:void(0)">';
        if(type == "初始" || type == "下发失败"){
            htmlStr = htmlStr + '配置</a>';
        }else{
            htmlStr = htmlStr + '详情</a>';
        }
    }
    if(type == "初始" || type == "下发失败"){
        if(checkElement('giveTask,')){
            if(htmlStr == "--"){
                htmlStr = '<a class="give btn btn-primary" href="javascript:void(0)">下发</a>';
            }else{
                htmlStr = htmlStr + '&nbsp;&nbsp;<a class="give btn btn-primary" href="javascript:void(0)">下发</a>';
            }
        }
        if(checkElement('taskCancel,')){
            if(htmlStr == "--"){
                htmlStr = '<a class="back btn btn-danger" href="javascript:void(0)" data-toggle="modal" data-target="#myModal">撤销</a>';
            }else{
                htmlStr = htmlStr + '&nbsp;&nbsp;<a class="back btn btn-danger" href="javascript:void(0)" data-toggle="modal" data-target="#myModal">撤销</a>';
            }
        }
    }else if(type == "正在下发"||type == "已下发" || type == "就绪"){
        if(checkElement('taskCancel,')){
            if(htmlStr == "--"){
                htmlStr = '<a class="back btn btn-danger" href="javascript:void(0)" data-toggle="modal" data-target="#myModal">撤销</a>';
            }else{
                htmlStr = htmlStr + '&nbsp;&nbsp;<a class="back btn btn-danger" href="javascript:void(0)" data-toggle="modal" data-target="#myModal">撤销</a>';
            }
        }
    }else if(type == "进行中"){
        if(checkElement('okTask,')){
            if(htmlStr == "--"){
                htmlStr = '<a class="ok btn btn-success" href="javascript:void(0)">完成</a>';
            }else{
                htmlStr = htmlStr + '&nbsp;&nbsp;<a class="ok btn btn-success" href="javascript:void(0)">完成</a>';
            }
        }
    }
    return [htmlStr].join('');
}
var taskid ;
var tasktype ;
var taskName;
function run(){
    $("#tableMask").show();
    $("#tableMask1").hide();
}
window.operateEventsForTask = {
    'click .give': function (e, value, row, index) {
        $("#tableMask").hide();
        $("#tableMask1").show();
        $.ajax({
            type : "POST",
            url : BasePath + "/task/giveTask.do",
            data : {'taskid' : row.id},
            dataType : "json",
            success : function(data) {
                if (data.retCode == SUCCESS) {
                    window.setInterval("run();", 3000);
                    successAlert();
                    $('#datatable').bootstrapTable('refresh',{url : BasePath+ '/task/queryTask.do'});
                } else{
                    window.setInterval("run();", 500);
                    messageDanger("下发任务失败", data.retMessage);
                }
            }
        });
    },
    'click .ok': function (e, value, row, index) {
        $.ajax({
            type : "POST",
            url : BasePath + "/task/okTask.do",
            data : {'taskid' : row.id},
            dataType : "json",
            success : function(data) {
                if (data.retCode == SUCCESS) {
                    successAlert();
                    $('#datatable').bootstrapTable('refresh',{url : BasePath+ '/task/queryTask.do'});
                } else{
                    messageDanger("完成任务失败", data.retMessage);
                }
            }
        });
    },
    'click .back': function (e, value, row, index) {
        sessionStorage.setItem("taskid4BackTask", row.id);
        $('#myModalLabel').html('撤销  "'+row.name+'" 任务');
    },
    'click .taskMore': function (e, value, row, index) {
        taskid = row.id;
        tasktype = row.tasktype;
        taskName = row.name;
        var totaltimes;
        if(row.totaltimes == 0){
            totaltimes = "无限次";
        }else{
            totaltimes = row.totaltimes+" 次";
        }
        $('#taskTitle').html("[<font size='5px;'>"+row.name+"</font>] 任务详情");
        var html = "<p><font size='3px;'>拨测地区：</font>"+row.location+"</p><p><font size='3px;'>　运营商：</font>"+row.operator+"</p><p><font size='3px;'>执行人员：</font>"
            +row.executor+"</p>";
        if(sessionStorage.getItem("loginCompanyName") == ""){//该账号没有企业
            html = html + "<p><font size='3px;'>　　企业：</font>"+row.companyname+"</p>";
        }
        html = html + "<p><font size='3px;'>任务状态：</font>"+tasktype+"</p><p><font size='3px;'>允许使用：</font>"+totaltimes
            +"</p><p><font size='3px;'>创建时间：</font>"+row.createtime+"</p><p><font size='3px;'>下发时间：</font>"+row.releasetime
            +"</p><p><font size='3px;'>执行时间：</font>"+row.starttime+"</p><p><font size='3px;'>完成时间：</font>"+row.endtime+"</p>";
        $('#taskMoreBase').html(html);
        ajaxTool();
    }
};
function ajaxTool(){    //samplebankFun(),targetFun()共用的ajax
    $('#taskMoreRefresh').html("<div align='center'><img src='images/loaders/loader6.gif'/></div>");
    var funSampleBank = "</p>";
    var funTarget = "</p>";
    if((tasktype == "初始"||tasktype == "下发失败")){
        if(checkElement('manageTargetByTask,')){
            funTarget = "<button class='btn btn-primary btn-xs' onclick='targetFun()'>管理靶机</button>"+funTarget;
        }
        if(checkElement('manageSampleBank,')){
            funSampleBank = "<button class='btn btn-primary btn-xs' onclick='samplebankFun()'>管理样本库</button>"+funSampleBank;
        }
    }
    $.ajax({            //任务下的靶机
        type : "POST",
        url : BasePath + "/taskTarget/selectTTaskTarget.do",
        data : {'taskid':taskid },
        dataType : "json",
        success : function(data) {
            var targetList = data.taskTargetList;
            $.ajax({             //任务下的样本库
                type : "POST",
                url : BasePath + "/taskSamplebank/selectTaskSamplebank.do",
                data : {'taskid':taskid },
                dataType : "json",
                success : function(data) {
                    var sampleBankList = data.taskSamplebankList;
                    var baseHtml ;
                    var baseTargetHtml = "<p><font size='3px;'>　　靶机：</font>"+funTarget;
                    var baseSampleBankHtml = "<p><font size='3px;'>　样本库：</font>"+funSampleBank;
                    baseHtml = baseSampleBankHtml;
                    for ( var i = 0; i < sampleBankList.length; i++) {
                        if(i==0){
                            baseHtml = baseHtml + "<table class='tdate'><tr><th>样本库名</th><th>样本库类型</th><th>样本数量</th></tr>";
                        }
                        var str = "--";
                        var count = sampleBankList[i].count4Sample;
                        if(count>=0){
                            str = count;
                        }
                        baseHtml = baseHtml + "<tr><td>"+sampleBankList[i].bankname+"</td><td>"+sampleBankList[i].type+"</td><td>"+str+"</td></tr>";
                        if(i==sampleBankList.length-1){
                            baseHtml = baseHtml + "</table>";
                        }
                    }
                    baseHtml = baseHtml + baseTargetHtml;
                    for ( var i = 0; i < targetList.length; i++) {
                        if(i==0){
                            if(tasktype == '已下发' && checkElement('redeploy,')){
                                baseHtml = baseHtml + "<table class='tdate'><tr><th>地区</th><th>运营商</th><th>IP地址</th><th>端口</th><th>下发状态</th><th>部署状态</th><th>操作</th></tr>";
                            }else{
                                baseHtml = baseHtml + "<table class='tdate'><tr><th>地区</th><th>运营商</th><th>IP地址</th><th>端口</th><th>下发状态</th><th>部署状态</th></tr>";
                            }
                        }
                        baseHtml = baseHtml + "<tr><td>"+targetList[i].location+"</td><td>"+targetList[i].operator+"</td><td>"+targetList[i].ip+"</td><td>"+targetList[i].targetport+"</td><td>"+targetList[i].state1+"</td><td>"+targetList[i].state+"</td>";
                        if(tasktype == '已下发' && checkElement('redeploy,')){
                            if(targetList[i].state!='部署成功'){
                                baseHtml = baseHtml + "<td><a href='javascript:void(0);' onClick='resetGiveTask("+targetList[i].targetid+")'>重新部署</a></td></tr>";
                            }else{
                                baseHtml = baseHtml + "<td>--</td></tr>";
                            }
                        }else{
                            baseHtml = baseHtml + "</tr>";
                        }
                        if(i==targetList.length-1){
                            baseHtml = baseHtml + "</table>";
                        }
                    }
                    $('#taskMoreRefresh').html(baseHtml);
                    $('.tdate').addClass("table table-hover table-striped");
                    $('.tdate th').attr("style","text-align: center; vertical-align: middle; ");
                    $('.tdate td').attr("style","text-align: center; vertical-align: middle; ");
                }
            });
        }
    });
}
function samplebankFun(){
    sessionStorage.setItem("taskid4SampleInfo", taskid);
    sessionStorage.setItem("tasktype4SampleInfo", tasktype);
    sessionStorage.setItem("taskName4SampleInfo", taskName);
    var url = '#/task4SampleBankInfo';
    var winInfo = 'height=600,width=500,top=10,left=590,toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no,status=no';
    var winObj = window.open(url,'样本库页',winInfo);
    var loop = setInterval(function() {
        if(winObj.closed) {
            clearInterval(loop);
            ajaxTool();
        }
    }, 1);
}
function targetFun(){
    sessionStorage.setItem("taskid4TargetInfo", taskid);
    sessionStorage.setItem("tasktype4TargetInfo",tasktype);
    sessionStorage.setItem("taskName4TargetInfo", taskName);
    var url = '#/task4TargetInfo';
    var winInfo = 'height=600,width=500,top=10,left=590,toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no,status=no';
    var winObj = window.open(url,'靶机页',winInfo);
    var loop = setInterval(function() {
        if(winObj.closed) {
            clearInterval(loop);
            ajaxTool();
        }
    }, 1);
}
function resetGiveTask(targetId){
    $.ajax({
        type : "POST",
        url : BasePath + "/task/resetGiveTask.do",
        data : {'taskid' : taskid,'targetid':targetId},
        dataType : "json",
        success : function(data) {
            if (data.retCode == SUCCESS) {
                successAlert();
                ajaxTool();
            } else{
                messageDanger("重新部署失败", data.retMessage);
            }
        }
    });
}
function operateFormatterForTaskTarget(value, row, index) {
    return [
        '<a class="delete btn btn-danger" data-toggle="modal" data-target="#myModal" href="javascript:void(0)" title="删除">删除</a>',].join('');
}
window.operateEventsForTaskTarget = {
    'click .delete': function (e, value, row, index) {
        sessionStorage.setItem("taskTargetid4DeleteTarget", row.targetid);
        $("#myModalLabel").text('删除  "'+row.ip+':'+row.targetport+'" 靶机');
    }
};
function operateFormatterTask4SampleBank(value, row, index) {
    return [
        '<a class="delete btn btn-danger" data-toggle="modal" data-target="#myModal" href="javascript:void(0)" title="删除">删除</a>',].join('');
}
window.operateEventsForTask4SampleBank = {
    'click .delete': function (e, value, row, index) {
        sessionStorage.setItem("samplebankid4DeleteSampleBank", row.samplebankid);
        $("#myModalLabel").text('删除  "'+row.bankname+'" 样本库');
    }
};
function operateFormatterForEditSampleName(value, row, index) {
    return [
        '<a class="edit btn btn-primary" href="javascript:void(0)" title="修改">修改</a>',].join('');
}
window.operateEventsForSampleName = {
    'click .edit': function (e, value, row, index) {
        sessionStorage.setItem("id4EditSample", row.id);
        sessionStorage.setItem("name4EditSample", row.name);
        sessionStorage.setItem("updateFlag", row.state);
        location.href="#/editSample";
    },
};

function operateFormatterForClient(value, row, index) {
    return [
        '<a class="btn btn-primary" href="'+row.downLoadUrl+'" title="下载拨测客户端">',
        '&nbsp;下载</a>',].join('');
}
function operateFormatterForClient2(value, row, index) {
    return [
        '<a class="btn btn-primary" href="'+row.downLoadUrl+'" title="下载拨测软件包">',
        '&nbsp;下载</a>',].join('');
}

function operateFormatterForTaskresult(value, row, index){
    if(row.nottestnumber>0){
        return [
            '<a class="taskresult btn btn-primary" href="javascript:void(0)" title="查看详细结果">',
            '&nbsp;查看详细结果</a>',].join('');
    }else{
        return ['--',].join('');
    }
}
window.operateEventsForTaskresult = {
    'click .taskresult':function (e, value, row, index){
        sessionStorage.setItem("taskresultid", row.id);
        sessionStorage.setItem("taskName", row.taskname);
        location.href="#/taskresultdetailInfo";
    }
};
function operateFormatterForUpevilnumber(value, row, index){
    if(row.upevilnumber == 0){
        return [row.upevilnumber].join('');
    }else{
        return ['<a class="upevilnumber btn btn-primary" data-toggle="modal" data-target="#myLargeModalLabel" href="javascript:void(0)" title="查看恶意样本">'+row.upevilnumber+'</a>'
        ].join('');
    }
}
window.operateEventsForUpevilnumber = {
    'click .upevilnumber':function (e, value, row, index){
        $.ajax({
            type : "POST",
            url : BasePath + "/taskresultNottestSample/query.do",
            data : {'taskresultid' : row.id,
                'sampletype': '0'
            },
            dataType : "json",
            success : function(data) {
                if (data.retCode == SUCCESS) {
                    $('#list').html(data.result.html);
                    $('#sampleName').text("检测-恶意样本");
                    $('table').addClass("table table-hover table-striped");
                    $('th').attr("style","text-align: center; vertical-align: middle; ");
                    $('td').attr("style","text-align: center; vertical-align: middle; ");
                } else{

                }
            }
        });
    }
};
function operateFormatterForUpnormalnumber(value, row, index){
    if(row.upnormalnumber == 0){
        return [row.upnormalnumber].join('');
    }else{
        var str ='<a class="upnormalnumber btn btn-primary" data-toggle="modal" data-target="#myLargeModalLabel" href="javascript:void(0)" title="查看正常样本">';
        return [str,row.upnormalnumber,'</a>'].join('');
    }
}
window.operateEventsForUpnormalnumber= {
    'click .upnormalnumber':function (e, value, row, index){
        $.ajax({
            type : "POST",
            url : BasePath + "/taskresultNottestSample/query.do",
            data : {'taskresultid' : row.id,
                'sampletype': '1'
            },
            dataType : "json",
            success : function(data) {
                if (data.retCode == SUCCESS) {
                    $('#list').html(data.result.html);
                    $('#sampleName').text("检测-正常样本");
                    $('table').addClass("table table-hover table-striped");
                    $('th').attr("style","text-align: center; vertical-align: middle; ");
                    $('td').attr("style","text-align: center; vertical-align: middle; ");
                } else{

                }
            }
        });
    }
};
function operateFormatterForUplikenumber(value, row, index){
    if(row.uplikenumber == 0){
        return [row.uplikenumber].join('');
    }else{
        var str ='<a class="uplikenumber btn btn-primary" data-toggle="modal" data-target="#myLargeModalLabel" href="javascript:void(0)" title="查看疑似样本">';
        return [str,row.uplikenumber,'</a>'].join('');
    }
}
window.operateEventsForUplikenumber= {
    'click .uplikenumber':function (e, value, row, index){
        $.ajax({
            type : "POST",
            url : BasePath + "/taskresultNottestSample/query.do",
            data : {'taskresultid' : row.id,
                'sampletype': '2'
            },
            dataType : "json",
            success : function(data) {
                if (data.retCode == SUCCESS) {
                    $('#list').html(data.result.html);
                    $('#sampleName').text("检测-疑似样本");
                    $('table').addClass("table table-hover table-striped");
                    $('th').attr("style","text-align: center; vertical-align: middle; ");
                    $('td').attr("style","text-align: center; vertical-align: middle; ");
                } else{

                }
            }
        });
    }
};
function operateFormatterForNottestnumber(value, row, index){
    if(row.nottestnumber == 0){
        return [row.nottestnumber].join('');
    }else{
        var str ='<a class="nottestnumber btn btn-primary" data-toggle="modal" data-target="#myLargeModalLabel" href="javascript:void(0)" title="查看未检测样本">';
        return [str,row.nottestnumber,'</a>'].join('');
    }
}
window.operateEventsForNottestnumber= {
    'click .nottestnumber':function (e, value, row, index){
        $.ajax({
            type : "POST",
            url : BasePath + "/taskresultNottestSample/query.do",
            data : {'taskresultid' : row.id,
                'sampletype': '3'
            },
            dataType : "json",
            success : function(data) {
                if (data.retCode == SUCCESS) {
                    $('#list').html(data.result.html);
                    $('#sampleName').text("任务未检测恶意样本");
                    $('table').addClass("table table-hover table-striped");
                    $('th').attr("style","text-align: center; vertical-align: middle; ");
                    $('td').attr("style","text-align: center; vertical-align: middle; ");
                } else{

                }
            }
        });
    }
};
function operateFormatterForDdosInfo(value, row, index) {
    if(row.state=="0"){
        return [
            '<div class="toggle-div"><div class="toggle toggle-primary toggle-on" id="'+row.id+'"></div></div>',].join('');
    }else{
        return [
            '<div class="toggle-div"><div class="toggle toggle-primary toggle-off" id="'+row.id+'"></div></div>',].join('');
    }
}
function operateFormatterForEditDdos(value, row, index) {
    var htmlStr = "";
    if(checkElement('checkDdosTask,')){
        htmlStr = '<a class="lookDdosTask btn btn-white" data-toggle="modal" data-target="#myLargeModalLabel" href="javascript:void(0)" title="查看任务">查看任务</a>';
    }
    if(checkElement('arrangeDdosTool,') && row.arrangestate != "正在部署" && row.state == '0'){
        if(htmlStr == ""){
            htmlStr = '<a class="arrange btn btn-info" href="javascript:void(0)" title="一键部署">一键部署</a>';
        }else{
            htmlStr = htmlStr + '&nbsp;&nbsp;<a class="arrange btn btn-info" href="javascript:void(0)" title="一键部署">一键部署</a>';
        }
    }
    if(checkElement('editDdosTool,')){
        if(htmlStr == ""){
            htmlStr = '<a class="edit btn btn-primary" href="javascript:void(0)" title="修改">修改</a>';
        }else{
            htmlStr = htmlStr + '&nbsp;&nbsp;<a class="edit btn btn-primary" href="javascript:void(0)" title="修改">修改</a>';
        }
    }
    if(checkElement('uninstallDdosTool,') && row.arrangestate != "未部署" && row.arrangestate != "正在部署" && row.state == '0'){
        if(htmlStr == ""){
            htmlStr = '<a class="uninstall btn btn-danger" href="javascript:void(0)" title="卸载">卸载</a>';
        }else{
            htmlStr = htmlStr + '&nbsp;&nbsp;<a class="uninstall btn btn-danger" href="javascript:void(0)" title="卸载">卸载</a>';
        }
    }
    if(checkElement('supervisoryDdos,') && row.arrangestate == "部署成功"){
        if(htmlStr == ""){
            htmlStr = '<a class="supervisory btn btn-warning" href="javascript:void(0)" title="监控">监控</a>';
        }else{
            htmlStr = htmlStr + '&nbsp;&nbsp;<a class="supervisory btn btn-warning" href="javascript:void(0)" title="监控">监控</a>';
        }
    }
    if(checkElement('historySupervisoryDdos,') && row.arrangestate == "部署成功"){
        if(htmlStr == ""){
            htmlStr = '<a class="historySupervisory btn btn-black" href="javascript:void(0)" title="历史监控">历史监控</a>';
        }else{
            htmlStr = htmlStr + '&nbsp;&nbsp;<a class="historySupervisory btn btn-black" href="javascript:void(0)" title="历史监控">历史监控</a>';
        }
    }
    return [htmlStr].join('');
}
window.operateEventsForDdos = {
    'click .edit': function (e, value, row, index) {
        sessionStorage.setItem("id4EditDdos", row.id);
        sessionStorage.setItem("location4EditDdos", row.location);
        sessionStorage.setItem("shefip4EditDdos", row.shefip);
        sessionStorage.setItem("user4EditDdos", row.user);
        sessionStorage.setItem("password4EditDdos", row.password);
        sessionStorage.setItem("arrangestate4EditDdos", row.arrangestate);
        location.href="#/editDdosTool";
    },
    'click .lookDdosTask': function (e, value, row, index) {
        sessionStorage.setItem("id4DdosTaskTool", row.id);
        sessionStorage.setItem("shefip4EditDdos", row.shefip);
        location.href="#/ddosTool4TaskInfo";
    },
    'click .arrange': function (e, value, row, index) {
        $.ajax({
            type : "POST",
            url : BasePath + '/DdosTool/arrange.do',
            data : {
                'id' : row.id
            },
            dataType : "json",
            success : function(data) {
                if (data.retCode == SUCCESS) {
                    successAlert();
                    $('#datatable').bootstrapTable('refresh',{url : BasePath+ '/DdosTool/queryDdosTool.do'});
                } else{
                    messageDanger("一键部署失败",data.retMessage);
                }
            }
        });
    },
    'click .uninstall': function (e, value, row, index) {
        $('.uninstall').attr("disabled", true);
        $.ajax({
            type : "POST",
            url : BasePath + '/DdosTool/uninstall.do',
            data : {
                'id' : row.id
            },
            dataType : "json",
            success : function(data) {
                if (data.retCode == SUCCESS) {
                    successAlert();
                    $('#datatable').bootstrapTable('refresh',{url : BasePath+ '/DdosTool/queryDdosTool.do'});
                } else if(data.retCode == "-1"){
                    $('.uninstall').removeAttr("disabled");
                    messageDanger("卸载失败",data.result);
                } else {
                    $('.uninstall').removeAttr("disabled");
                    messageDanger("卸载失败",data.retMessage);
                }
            }
        });
    },
    'click .supervisory': function (e, value, row, index) {
        sessionStorage.setItem("shefip4SupervisoryDdos", row.shefip);
        location.href="#/supervisory4Ddos";
    },
    'click .historySupervisory': function (e, value, row, index) {
        sessionStorage.setItem("shefip4SupervisoryDdos", row.shefip);
        location.href="#/historySupervisory4Ddos";
    }
};
function operateFormatterForEditDdos2(value, row, index) {
    return [
        '<span class="wi-sunset" style="'+row.nowState+'" id="'+row.shefip.replace(/\./g,'-')+'-8081"></span>',].join('');
}

function operateFormatterForDdostask(value, row, index) {
    var htmlStr='--';
    var type=row.taskstate;
    if(checkElement('manageDdosToolByDdosTask,')){
        htmlStr='<a class="ddos btn btn-white" data-toggle="modal" href="javascript:void(0)">管理攻击端</a>';
    }
    if(type == "初始" || type == "下发失败"){
        if(checkElement('giveDdosTask,')){
            if(htmlStr == "--"){
                htmlStr = '<a class="give btn btn-primary" href="javascript:void(0)">下发</a>';
            }else{
                htmlStr=htmlStr+'&nbsp;&nbsp;<a class="give btn btn-primary" href="javascript:void(0)">下发</a>';
            }
        }
        if(checkElement('ddosTaskCancel,')){
            if(htmlStr == "--"){
                htmlStr = '<a class="back btn btn-danger" href="javascript:void(0)" data-toggle="modal" data-target="#myModal">撤销</a>';
            }else{
                htmlStr=htmlStr+'&nbsp;&nbsp;<a class="back btn btn-danger" href="javascript:void(0)" data-toggle="modal" data-target="#myModal">撤销</a>';
            }
        }
    }else if(type == "已下发" || type == "正在下发"){
        if(checkElement('ddosTaskCancel,')){
            if(htmlStr == "--"){
                htmlStr = '<a class="back btn btn-danger" href="javascript:void(0)" data-toggle="modal" data-target="#myModal">撤销</a>';
            }else{
                htmlStr=htmlStr+'&nbsp;&nbsp;<a class="back btn btn-danger" href="javascript:void(0)" data-toggle="modal" data-target="#myModal">撤销</a>';
            }
        }
    }else if(type == "进行中"){
        if(checkElement('okDdosTask,')){
            if(htmlStr == "--"){
                htmlStr = '<a class="ok btn btn-success" href="javascript:void(0)">完成</a>';
            }else{
                htmlStr=htmlStr+'&nbsp;&nbsp;<a class="ok btn btn-success" href="javascript:void(0)">完成</a>';
            }
        }
    }
    return [htmlStr].join('');
}
window.operateEventsForDdostask = {
    'click .ddos': function (e, value, row, index) {
        sessionStorage.setItem("ddostaskid4TargetInfo", row.id);
        sessionStorage.setItem("ddostaskstate4TargetInfo", row.taskstate);
        sessionStorage.setItem("ddostaskname4TargetInfo", row.name);
        location.href="#/ddosTask4ToolInfo";
    },
    'click .give': function (e, value, row, index) {
        $("#tableMask").hide();
        $("#tableMask1").show();
        $.ajax({
            type : "POST",
            url : BasePath + "/ddostask/giveDdosTask.do",
            data : {'taskid' : row.id},
            dataType : "json",
            success : function(data) {
                if (data.retCode == SUCCESS || data.retCode == "1203") {
                    window.setInterval("run();", 3000);
                    successAlert();
                    $('#datatable').bootstrapTable('refresh',{url : BasePath+ '/ddostask/queryDdosTask.do'});
                } else{
                    if(data.retCode == "1208"){
                        $('#datatable').bootstrapTable('refresh',{url : BasePath+ '/ddostask/queryDdosTask.do'});
                    }
                    window.setInterval("run();", 500);
                    messageDanger("下发任务失败", data.retMessage);
                }
            }
        });
    },
    'click .ok': function (e, value, row, index) {
        $.ajax({
            type : "POST",
            url : BasePath + "/ddostask/okDdosTask.do",
            data : {'taskid' : row.id},
            dataType : "json",
            success : function(data) {
                if (data.retCode == SUCCESS) {
                    successAlert();
                    $('#datatable').bootstrapTable('refresh',{url : BasePath+ '/ddostask/queryDdosTask.do'});
                } else{
                    messageDanger("完成任务失败", data.retMessage);
                }
            }
        });
    },
    'click .back': function (e, value, row, index) {
        sessionStorage.setItem("ddosTaskid4BackTask", row.id);
        $('#myModalLabel').html('撤销  "'+row.name+'" 任务');
    }
};

function operateFormatterForDdosTaskTool(value, row, index) {
    return [
        '<a class="delete btn btn-danger" data-toggle="modal" data-target="#myModal" href="javascript:void(0)" title="删除">删除</a>',].join('');
}
window.operateEventsForDdosTaskTool = {
    'click .delete': function (e, value, row, index) {
        sessionStorage.setItem("DdosToolid4DeleteTool", row.toolid);
        $("#myModalLabel").text('删除  "'+row.shefip+'" 攻击端');
    }
};
//角色修改、删除
function operateFormatterForRole(value, row, index) {
    var htmlStr = "";
    if(checkElement('editRole,')){
        htmlStr='<a class="edit btn btn-primary" href="javascript:void(0)" title="修改">修改</a>';
    }
    if(checkElement('deleteRole,')){
        if(htmlStr == ""){
            htmlStr= '<a class="delete btn btn-danger" data-toggle="modal" data-target="#myModal" href="javascript:void(0)" title="删除">删除</a>';
        }else{
            htmlStr = htmlStr + '&nbsp;&nbsp;<a class="delete btn btn-danger" data-toggle="modal" data-target="#myModal" href="javascript:void(0)" title="删除">删除</a>';
        }
    }
    return [htmlStr].join('');
}
window.operateEventsForRole = {
    'click .edit': function (e, value, row, index) {
        sessionStorage.setItem("roleId", row.id);
        sessionStorage.setItem("name", row.name);
        location.href="#/editRole";
    },
    'click .delete': function (e, value, row, index) {
        sessionStorage.setItem("roleId", row.id);
        $("#myModalLabel").text('删除  "'+row.name+'" 角色');
    }
};
function operateFormatterForCompany(value, row, index) {
    var htmlStr = "";
    if(checkElement('manageTargetByCompany,')){
        htmlStr = '<a class="target btn btn-white" href="javascript:void(0)" title="管理靶机">管理靶机</a>';
    }
    if(checkElement('editCompany,')){
        if(htmlStr == ""){
            htmlStr = '<a class="edit btn btn-primary" href="javascript:void(0)" title="修改">修改</a>';
        }else{
            htmlStr = htmlStr +'&nbsp;&nbsp;<a class="edit btn btn-primary" href="javascript:void(0)" title="修改">修改</a>';
        }
    }
    if(checkElement('manageSampleByCompany,')){
        if(htmlStr == ""){
            htmlStr = '<a class="sample btn btn-white" href="javascript:void(0)" title="管理样本">管理样本</a>';
        }else{
            htmlStr = htmlStr +'&nbsp;&nbsp;<a class="sample btn btn-white" href="javascript:void(0)" title="管理样本">管理样本</a>';
        }
    }
    return [htmlStr].join('');
}
window.operateEventsForCompany = {
    'click .target': function (e, value, row, index) {
        sessionStorage.setItem("companyId", row.id);
        sessionStorage.setItem("companyName", row.name);
        sessionStorage.setItem("companyTargetIds", row.targetIds);
        location.href="#/company4TargetInfo";
    },
    'click .edit': function (e, value, row, index) {
        sessionStorage.setItem("companyId", row.id);
        sessionStorage.setItem("companyName", row.name);
        sessionStorage.setItem("companyTaskNum", row.taskNum);
        //查询该企业已经使用的任务数量
        $.ajax({
            type : "POST",
            url : BasePath + "/company/companyUseTaskNumber.do",
            data: {
                'companyid' : row.id
            },
            dataType : "json",
            success : function(data) {
                sessionStorage.setItem("companyUsedTaskNum", data.result.count);
                location.href="#/editCompany";
            }
        });
    },
    'click .sample': function (e, value, row, index) {
        sessionStorage.setItem("companyId", row.id);
        sessionStorage.setItem("companyName", row.name);
        location.href="#/company4SampleInfo";
    }
};
function operateFormatterForCompanyTarget(value, row, index) {
    var htmlStr= '<a class="delete btn btn-danger" data-toggle="modal" data-target="#myModal" href="javascript:void(0)" title="删除">删除</a>';
    return [htmlStr].join('');
}
window.operateEventsForCompanyTarget = {
    'click .delete': function (e, value, row, index) {
        sessionStorage.setItem("company4TargetId", row.id);
        $("#myModalLabel").text('删除  "'+row.ip+':'+row.targetport+'" 靶机');
    }
};
function operateFormatterForCompanySample(value, row, index) {
    var htmlStr= '<a class="delete btn btn-danger" data-toggle="modal" data-target="#myModal" href="javascript:void(0)" title="删除">删除</a>';
    return [htmlStr].join('');
}
window.operateEventsForCompanySample = {
    'click .delete': function (e, value, row, index) {
        sessionStorage.setItem("company4SampleId", row.sampleid);
    }
};